package com.baasp.gateway.controller;

import com.baasp.gateway.config.GatewayConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created by simon on 2019/5/24.
 */
@RestController
public class ConfigController {

    @Autowired
    private GatewayConfig appConfig;

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/config")
    public String getConfig(){
        return appConfig.toString();
    }

    @GetMapping("/getBackendConfig")
    public String findByUserId(){
        return restTemplate.getForObject("http://baasp-backend/getConfig", String.class);
    }
}
